<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html lang="en">

<head>
<title>用户登陆界面</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="assets/css/bootstrap.min.css" />
<link rel="stylesheet" href="assets/css/bootstrap-responsive.min.css" />
<link rel="stylesheet" href="assets/css/buttons.css" />

<style type="text/css">
#ToolBar {
	position: absolute;
	bottom: 0px;
	width: 100%;
	height: 50px;
	text-align: center;
	z-index: 2;
	overflow: hidden;
}
.middin {
	position: absolute;
	left: 30%;
}
</style>
</head>
<body style="background-image:url('assets/img/login-logos.png'); width:80%; height:80%;">
		<div class="middin" style=" margin-top: 150px; margin-left: auto; margin-right: auto;">
			<div style="background-image: url('assets/img/log2.gif');  width: 884px ; height:315px;">

				<div style="float: right; position:absolute; right: 20%; top: 10%">
					<p class="text-error" style="font-size: 50px;">
						<strong>锁屏收益后台</strong>
					</p>
					<br /> <br />
					<div>
						<span class="add-on"><strong style="font-size: 30px;">用户名:&nbsp;</strong>
						</span><input id="usrename" name="uname" type="text"
							onblur="checkUname(this.value)" placeholder="请输入用户名" /> <span
							id="errorMusername"></span>
					</div>
					<br />

					<div>
						<span class="add-on"><strong style="font-size: 30px;">密&nbsp;
								&nbsp;&nbsp;码:&nbsp;</strong> </span><input id="passwd" name="password"
							type="password" onblur="checkPassWD(this.value)"
							placeholder="请输入密码" /> <span id="errorPwd"></span>
					</div>
					 <span class="pull-right" style="margin-right:25px;">
					 <a id="btnLogin" onclick="login();" class="button big red">登录</a> </span>
				</div>
			</div>

			<div style="margin-top:-185px; margin-right:-380px; float: right;">
				<img alt="" width="50%" height="50%" src="assets/img/ren-login.png" />
			</div>
		</div>

		<div id="ToolBar">
			<h4 >© 2014 黑格投资. All Rights Reserved
				沪ICP备13018436号-7</h4>
		</div>
	<script src="assets/js/jquery.min.js"></script>
	<script type="text/javascript">
		function checkUname(value) {
			if (value.length <= 0) {
				$("#errorMusername").css("color", "red").text("*用户名不为空");
				return false;
			}
			return true;
		}

		function checkPassWD(value) {
			if (value.length <= 0) {
				$("#errorPwd").css("color", "red").text("*密码不为空");
				return false;
			}
			return true;
		}

		function login() {
			var username = $("#usrename").val();
			var pwd = $("#passwd").val();
			if (username.length <= 0) {
				alert("请输入用户名。");
				return false;
			}
			var mydata = '{"uname":"' + username + '","passwd":"' + pwd + '"}';

			$
					.ajax({
						type : "post",
						contentType : 'application/json',
						url : "${pageContext.request.contextPath}/person/login.do",
						data : mydata,
						processData : false,
						datatype : "json",
						success : function(data) {
							if (data.status == 0) {
								alert(data.message);
								$("#usrename").attr("value", "");
								$("#passwd").attr("value", "");
							} else if (data.status == 1) {
								document.location.href = "${pageContext.request.contextPath}/main.do";
							}
						}
					});
		}
	</script>
</body>
</html>
